<?php

function incluir($pagina) {
    if (!in_array("bd.php", get_included_files())):
        include $pagina;
    endif;
}

date_default_timezone_set('America/Sao_Paulo'); //or change to whatever timezone you want
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
if (file_exists('conf.php')):
    include 'conf.php';
else:
    include 'conf.sample.php';
endif;
include 'pkj.php';
include 'bd.php';
include 'componentes.php';
include 'sessao.php';
include "smarty/Smarty.class.php";
include 'kint/Kint.class.php';
include 'YaLinqo/Linq.php';
include 'Form.php';

//include 'form.php';
function negar() {
    ?>
    <!DOCTYPE html>
    <html>
        <head>
            <title></title>
            <?php
            import('jquery');
            import('tema');
            import('bind');
            ?>
        <head>
        <body>
        <center><h1 style="color:red">ACESSO NEGADO</h1></center>
        <center><h4><?= session_get("nome") . " | " . session_get("nivel") ?></h4></center>
    </body>
    </html>
    <?php
    exit();
}

include 'bind.php';

if (post("pkjCMDWWW") != ""):
    echo "/*Tem comando " . post("pkjCMDWWW") . "*/";
    if (trim(post("pkjCMDPAGE")) != "") {
//        echo "/*Tem pagina " . post("pkjCMDPAGE") . "*/";
        ob_start();
        require_once (trim(post("pkjCMDPAGE")));
        ob_end_clean();
//        echo "/* Verificando se " . post("pkjCMDWWW") . " existe = " . function_exists(post("pkjCMDWWW")) . "*/";
    }
    if (function_exists(post("pkjCMDWWW"))):
//        $dados = new stdClass();
//        foreach ($_POST as $key => $value) {
//            //eval('$dados->'.$key.' = addslashes($value);');
//            $dados->{$key} = @addslashes($value);
//        }
        $dadinho = $_POST;
        addslashes_array($dadinho);
        $object = new stdClass();
        $object = (object) $dadinho;
        if (!true) {
            eval(post("pkjCMDWWW") . '($object);');
        } else {
            eval(post("pkjCMDWWW") . '($dadinho);');
        }
    endif;
    exit();
endif;
ob_start();
?>
